package test.jxl;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

import java.io.File;
import java.io.IOException;

/**
 * 功能：
 * 作者： yangyan
 * 时间： 2015/4/13 .
 */
public class JxlReadExcel {
    public static void main(String[] args) {
        try {
            Workbook workbook = Workbook.getWorkbook(new File("test_file/jxl_test.xls"));
            Sheet sheet1 = workbook.getSheet("sheet1");

            for (int i = 0; i < sheet1.getRows(); i++) {
                for (int j = 0; j < sheet1.getColumns(); j++) {
                    Cell cell = sheet1.getCell(j, i);
                    System.out.print(cell.getContents() + "\t");
                }
                System.out.println("\n");
            }
            workbook.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (BiffException e) {
            e.printStackTrace();
        }
    }
}
